var g, _extends = Object.assign || function (t) {
    for (var e = 1; e < arguments.length; e++) {
      var a, r = arguments[e];
      for (a in r) Object.prototype.hasOwnProperty.call(r, a) && (t[a] = r[a]);
    }
    return t;
  },
  _tools = require("../../utils/tools"),
  app = getApp(),
  page = app.page,
  request = app.util.request,
  route = app.route,
  toast = app.toast;
page({
  data: {
    real_name: "",
    idcard: "",
    userInfo: ""
  },
  onLoad: function (t) {
    g = this;
    let userInfo = wx.getStorageSync("userInfo")
    if (userInfo) {
      request({
        url: "AddUsersLog",
        data: {
          user_id: userInfo.id,
          url: '/fenxiao/idcard/idcard',
          title: "实名信息"
        },
        success: function (a) {}
      })
    }
    request({
      url: "Openid",
      showLoading: !1,
      data: {
        user_id: g.data.userInfo.id
      },
      success: function (t) {
        wx.setStorageSync("userInfo", t)
        g.setData({
          userInfo: t,
          idcard: t.idcard,
          real_name: t.real_name
        })
      }
    })
  },
  onReady: function () {
    var t = wx.getSystemInfoSync().screenWidth,
      e = .04 * t,
      t = (e * e + t * t / 4) / (2 * e);
    g.setData({
      style: "background: radial-gradient(circle at 50% " + (e - t) + "px, " + wx.getStorageSync("system").foot_color2 + " " + t + "px, rgba(0,0,0,0) " + t / 2 + "px);"
    }), (0, _tools.getNodeInfo)({
      id: "#top",
      success: function (t) {
        // return g.setData({
        //   top: t.bottom
        // });
      }
    });
  },
  onShow: function () {

  },
  onPullDownRefresh: function () {

  },
  idcardInput: function (t) {
    g.setData({
      idcard: t.detail.value
    });
  },
  realNameInput: function (t) {
    g.setData({
      real_name: t.detail.value
    });
  },
  submit() {
    if (!g.data.real_name) {
      toast("请输入您的姓名");
      return false
    }
    if (!g.data.idcard) {
      toast("请输入您的身份证");
      return false
    }
    request({
      url: "SetUserRealInfo",
      data: {
        real_name: g.data.real_name,
        idcard: g.data.idcard,
        user_id: g.data.userInfo.id
      },
      success: function (t) {
        toast("提交成功");
      }
    });
  },
});